<?php

use think\Db;
use think\migration\Migrator;
use think\migration\db\Column;

class CreateConfigData extends Migrator
{
    public function up()
    {

        $data = [
            [
                'name' => 'logo',
                'title' => 'LOGO',
                'type' => 'picture',
                'create_time' => time(),
            ],[
                'name' => 'phone',
                'title' => '电话',
                'type' => 'text',
                'create_time' => time(),
            ],[
                'name' => 'email',
                'title' => '邮箱',
                'type' => 'text',
                'create_time' => time(),
            ],[
                'name' => 'postal_code',
                'title' => '邮编',
                'type' => 'number',
                'create_time' => time(),
            ],
            [
                'name' => 'desc',
                'title' => '简介',
                'type' => 'text',
                'create_time' => '1597851031',
                'value' => '简介',
            ],
        ];
        foreach ( $data as $item){
            Db::name('config')->insert($item);
        }

    }
    public function down()
    {
        Db::name('config')->where('id', '>', 0)->delete();
    }
}
